<template>
  <div style="width: 100%; height: 100%">
    <Header title="数据归集情况" />
    <div style="width: 100%; height: calc(100% - 70px); display: flex">
      <div style="height: 100%; width: 45%">
        <div id="dataEchart" style="width: 100%; height: 100%" />
      </div>
      <div
        style="
          height: 100%;
          width: 55%;
          display: flex;
          flex-direction: column;
          justify-content: space-between;
          padding: 0 40px 40px 0;
        ">
        <div
          style="
            display: flex;
            width: 100%;
            display: flex;
            justify-content: space-between;
            align-items: baseline;
            cursor: pointer;
          ">
          <div class="right_title">1C</div>
          <div style="width: 85%">
            <div
              style="
                display: flex;
                justify-content: space-between;
                align-items: center;
                font-size: 14px;
                color: #FFFFFF;
              ">
              <div>3条</div>
              <div>0.6TB</div>
            </div>
            <div style="cursor: pointer;">
              <el-progress :text-inside="true" :stroke-width="10" :percentage="0.6" />
            </div>
          </div>
        </div>
        <div
          style="
            display: flex;
            width: 100%;
            display: flex;
            justify-content: space-between;
            align-items: baseline;
            cursor: pointer;
          ">
          <div class="right_title">2C</div>
          <div style="width: 85%">
            <div
              style="
                display: flex;
                justify-content: space-between;
                align-items: center;
                font-size: 14px;
                color: #FFFFFF;
              ">
              <div>9条</div>
              <div>1.3TB</div>
            </div>
            <div style="cursor: pointer;">
              <el-progress :text-inside="true" :stroke-width="10" :percentage="1.3" />
            </div>
          </div>
        </div>
        <div
          style="
            display: flex;
            width: 100%;
            display: flex;
            justify-content: space-between;
            align-items: baseline;
            cursor: pointer;
          ">
          <div class="right_title">4C</div>
          <div style="width: 85%">
            <div
              style="
                display: flex;
                justify-content: space-between;
                align-items: center;
                font-size: 14px;
                color: #FFFFFF;
              ">
              <div>1条</div>
              <div>0.9TB</div>
            </div>
            <div style="cursor: pointer;">
              <el-progress :text-inside="true" :stroke-width="10" :percentage="0.9" />
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import { fontSize } from '@/utils'
import Header from './header.vue'
import 'echarts-liquidfill'
import echarts from 'echarts'
import { originalDataCheck } from '@/api/cms/index/index.js'
export default {
  components: {
    Header
  },
  props: {
    deptCode: {
      type: String,
      default: ''
    },
    railTypes: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
      data: {}
    }
  },
  watch: {
    railTypes() {
      this.init()
    }
  },
  mounted() {
    this.init()
    const that = this
    window.addEventListener('resize', function() {
      that.$nextTick((_) => {
        const myChart1 = echarts.init(document.getElementById('dataEchart'))
        myChart1.resize()
      })
    })
  },
  methods: {
    init() {
      // console.log('111111111111111111111111111111111')
      // originalDataCheck({
      //   deptCode: this.deptCode,
      //   railType: this.railTypes
      // }).then((res) => {
      //   console.log(res)
      //   this.data = res.data
      //   this.showEcharts()
      // })
      this.showEcharts()
    },
    showEcharts() {
      var value = 0.28
      console.log(value)
      var data = []
      data.push(0.28)

      const myChart1 = echarts.init(document.getElementById('dataEchart'))
      const option1 = {
        title: {},

        series: [
          {
            type: 'liquidFill',
            radius: '80%',
            data: data,
            backgroundStyle: {
              borderWidth: 2,
              borderColor: '#1b6491',
              color: 'rgb(255,0,255,0.01)'
            },
            label: {
              normal: {
                formatter: '28TB',
                textStyle: {
                  fontSize: fontSize(0.3),
                  color: 'rgba(102, 255, 255, 1)'
                }
              }
            },
            outline: {
              borderDistance: 3, // 外边框与内边框间的距离
              itemStyle: {
                borderWidth: 2, // 外边框的宽度
                borderColor: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
                  {
                    // 1代表上面        // 外边框的颜色（渐变色）
                    offset: 0,
                    color: '#1b6491'
                  },
                  {
                    offset: 1,
                    color: '#3399cc'
                  }
                ])
              }
            }
          }
        ]
      }
      myChart1.setOption(option1)
    },
    dialog6(CType) {
      this.$emit('module1Click', { moduleType: 'module5', title: '检测数据详情', CType })
    }
  }
}
</script>
<style lang="scss" scoped>
.num {
  font-family: YouSheBiaoTiHei;
  font-style: normal;
  font-weight: normal;
  font-size: 30px;
  color: #3e9cff;
}
.name {
  font-family: YouSheBiaoTiHei;
  font-style: normal;
  font-weight: normal;
  font-size: 18px;
  line-height: 23px;
}
.right_title {
  font-size: 16px;
  color: #ffffff;
  padding: 8px;
  background: #011c44;
  border: 1px solid #0155a2;
  box-sizing: border-box;
  border-radius: 8px;
}
/deep/ .el-progress-bar__innerText {
  display: none;
}
/deep/ .el-progress-bar__inner {
  background: linear-gradient(270deg, #4dffdf 0%, #4da1ff 96.35%);
}
/deep/ .el-progress-bar__outer {
  background: #142d5c;
}
</style>
